#ifndef WIN_GDI_H
#define WIN_GDI_H
#include <string>
#include <list>
#include "defines.h"

void render_init();
void render_destroy();
void render_start(DuiWinManager *mgr);
void render_end(DuiWinManager *mgr);

// render draw all logic
bool render_draw(DuiWinManager *mgr);

// basic render draw function

// setting
void render_draw_set_opacity(float opacity=1.0f); // 0.0 - 1.0，1.0 不透明。影响所有的绘制
void render_draw_set_scale(float scale=1.0f); // 1.0 不缩放，2.0 两倍大小。影响所有的绘制

// 区域填充
void render_draw_fill(DuiWinManager* mgr, DuiRect dest, DuiColor color, int radius=0);
void render_draw_image(DuiWinManager* mgr, DuiRect dest, std::string image);
void render_draw_image2(DuiWinManager* mgr, DuiRect dest, std::string image, DuiRect src, DUI_IMAGE_FIT fit=DUI_IMAGE_FIT_NONE);
void render_draw_image_svg(DuiWinManager* mgr, DuiRect dest, std::string code, DuiColor color);

// 点，线，矩形，圆
void render_draw_point(DuiWinManager* mgr, DuiPoint point, DuiColor color, int size);
void render_draw_line(DuiWinManager* mgr, DuiPoint p1, DuiPoint p2, DuiColor color, int width, DUI_LINE_STYLE style=DUI_LINE_STYLE_SOLID);
void render_draw_rect(DuiWinManager* mgr, DuiRect dest, DuiColor color, int width, DUI_LINE_STYLE style, int radius=0);
void render_draw_arc(DuiWinManager* mgr, DuiRect dest, DuiColor color, int width, DUI_LINE_STYLE style, int angle1, int angle2);

// 边框和阴影
void render_draw_border_image(DuiWinManager* mgr, DuiRect dest, DuiCorner corner, std::string image, DuiColor mask=DuiColor{0, 0, 0, 0});
void render_draw_shadow(DuiWinManager* mgr, DuiRect dest, DuiPoint args, int radius, DuiColor color, DuiColor colorCenter=DuiColor{0, 0, 0, 255});

// 文本
void render_draw_text(DuiWinManager* mgr, DuiPoint point, std::string& text, DuiColor color, std::string fontFamily, int fontSize, int fontWeight=400);
void render_draw_text(DuiWinManager* mgr, DuiPoint point, std::wstring& text, DuiColor color, std::string fontFamily, int fontSize, int fontWeight=400);
void render_draw_text(DuiWinManager* mgr, DuiRect rect, std::string& text, DuiColor color, DUI_TEXT_ALIGN alignx,DUI_TEXT_ALIGN aligny,std::string fontFamily, int fontSize, int fontWeight=400);
void render_draw_text(DuiWinManager* mgr, DuiRect rect, std::wstring& text, DuiColor color, DUI_TEXT_ALIGN alignx,DUI_TEXT_ALIGN aligny,std::string fontFamily, int fontSize, int fontWeight=400);

// 文字度量
DuiRect render_measure_text(DuiWinManager* mgr, std::wstring& text, std::string fontFamily, int fontSize, int fontWeight=400);
std::list<DuiCharLineInf> render_measure_parse_text(DuiWinManager *mgr, std::wstring &text, Gdiplus::Font &font, Gdiplus::Font &fontCb, Gdiplus::StringFormat &fmt, DuiRect &rc);

// render out
// void render_out_copy(DuiWinManager* mgr, DuiRect dest, DuiWinManager* mgr2, DuiRect src);


#endif // WIN_GDI_H
